from osc04a.optimization.get_cost import get_cost_with_simulation
from osc04a.static.constants import Debugs, Constants

seed = 0
best_x = [0, 0, 0, 1, 2, 0, 2, 3, 3, 0, 0, 1, 4, 5, 5, 5, 6, 5]

best_x = [0] * Constants.N_ACTIVITY

sum_cost = 0
for seed in range(1, 20):
    print("After solving the problem,plug the solution, best_x to plot")
    total_waiting_cost, total_late_delivery_penalty, project_late_completion_penalty \
        = get_cost_with_simulation(best_x,
                                   seed=seed,
                                   unit_waiting_penalty=Debugs.unit_component_late_acceptance_penalty_by_day,
                                   unit_late_delivery_penalty=Debugs.unit_late_delivery_penalty_by_day,
                                   unit_project_late_completion_penalty=Debugs.unit_project_late_completion_penalty_by_day,
                                   project_deadline=Debugs.project_deadline,
                                   debug=True
                                   )
    total_cost = total_waiting_cost - total_late_delivery_penalty + project_late_completion_penalty
    print(seed, total_cost)
    sum_cost += total_cost
    details = ['total cost = ', total_cost,
               'total_waiting_cost=', round(total_waiting_cost, 2),
               'total_late_delivery_penalty=', round(total_late_delivery_penalty, 2),
               'project_late_completion_penalty=', round(project_late_completion_penalty, 2)]

print(sum_cost, sum_cost / 20)
